<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui" xmlns:app="http://org.wsiz.vro/app"
	xmlns:appcc="http://java.sun.com/jsf/composite/components">
	<f:validateBean disabled="true">
		<p:fieldset legend="${msg.film}">
			<h:panelGrid columns="2" styleClass="aria-role-presentation">
				<appcc:outputLabel for="title" value="${msg.film_title}"
					required="true" />
				<p:inputText id="title" label="${msg.film_title}"
					value="#{film.title}" maxlength="80" rendered="#{not readonly}">
					<f:validateBean binding="#{lenientBeanValidator}" />
				</p:inputText>
				<h:outputText value="#{film.title}" rendered="#{readonly}" />

				<appcc:outputLabel for="year" value="${msg.film_year}"
					required="true" />
				<p:spinner id="year" label="${msg.film_year}" value="#{film.year}"
					rendered="#{not readonly}">
					<f:validateBean binding="#{lenientBeanValidator}" />
				</p:spinner>
				<h:outputText value="#{film.year}" rendered="#{readonly}" />

				<appcc:outputLabel for="description"
					value="${msg.film_description}" required="false" />
				<p:inputTextarea id="description" label="${msg.film_description}"
					value="#{film.description}" maxlength="1000"
					rendered="#{not readonly}"></p:inputTextarea>
				<h:outputText value="#{film.description}" rendered="#{readonly}" />

				<!-- note: bug prevent us from using appcc:outputLabel -->
				<label for="form:account_input">${msg.film_account}</label>
				<h:panelGrid columns="2" styleClass="aria-role-presentation">
					<p:autoComplete id="account" value="#{film.account}"
						label="${msg.film_account}"
						completeMethod="#{accountRepository.find}" var="item"
						itemValue="#{item}" itemLabel="#{accountConverter.print(item)}"
						converter="#{accountConverter}" rendered="#{not readonly}"
						size="50">
						<p:ajax event="itemSelect"
							listener="#{messageUtil.info('status_selected_ok',msg.film_account)}"
							update="messages" />
					</p:autoComplete>
					<h:outputText value="#{accountConverter.print(film.account)}"
						rendered="#{readonly}" />

					<h:panelGroup>
						<app:iconSearch action="selectAccount"
							title="${msg.film_account}" rendered="#{!readonly}" />
						<app:iconEdit action="editAccount" title="${msg.film_account}"
							rendered="#{!readonly and not empty film.account}" />
						<app:iconView action="viewAccount" title="${msg.film_account}"
							rendered="#{not empty film.account}" />
					</h:panelGroup>
				</h:panelGrid>


			</h:panelGrid>
			<app:saveButton title="${msg.film}" />
		</p:fieldset>
	</f:validateBean>



</ui:composition>
